angular.module('${menuCode}')
.controller("${widgetCode}Ctrl",function($scope,AppKit){
	
	$scope.setActiveTab = function (activeTab) {     
		　　$scope.activeTab = activeTab; 
	};
	
	$scope.initTabs = function(tabs){
		$scope.tabs = tabs;	
		$scope.activeTab = tabs[0];
	}
	
	$scope.findForumListInfos = function() {
		var url = '/portal/resource?ForumPost&actionType=mobilefindForumManageListInfos';
		var promise = AppKit.getJsonApi(url);
		promise.success(function(rspJson){
			$scope.report = rspJson.report;
			$scope.garbage = rspJson.garbage;
			$scope.reportCount = rspJson.reportCount;
			$scope.garbageCount = rspJson.garbageCount;
		});
	}
	$scope.findForumListInfos();
	
	$scope.onSwipeLeft = function(){
		for(var i=0;i< $scope.tabs.length;i++){
			var tempTab = $scope.tabs[i];
			if (tempTab == $scope.activeTab){
				if (i == ($scope.tabs.length-1))continue;
				
				$scope.activeTab = $scope.tabs[i+1];
				break;
			}
		}
	};

	$scope.onSwipeRight = function(){
		for(var i=0;i< $scope.tabs.length;i++){
			var tempTab = $scope.tabs[i];
			if (tempTab == $scope.activeTab){
				if (i == 0)continue;
				
				$scope.activeTab = $scope.tabs[i-1];
				break;
			}
		}
	};	
	
	$scope.openModal = function(id,text){
		$scope.modalTitle = text;
		$scope.currentInfoId = id;
		AppKit.createModal("bbs-content-modal",$scope);
	}
});